import request from "./request"


//添加一个岗位(通过token判断身份
export function addRec(recruitment){
    return request({
        url:'/recruitment/add',
        method:'post',
        data:recruitment
    })
}

//删除岗位
export function delRec(id){
    return request({
        url:'/recruitment/delete/'+id,
        method:'delete'
    })
}

//岗位职责
export function addDuty(recruitmentDuty){
    return request({
        url:'/recruitment/duty',
        method:'post',
        data:recruitmentDuty
    })
}

//编辑岗位职责
export function putDudy(recruitmentDuty){
    return request({
        url:'/recruitment/duty',
        method:'put',
        data:recruitmentDuty
    })
}

//删除岗位职责
export function delDudy(id){
    return request({
        url:'/recruitment/duty',
        method:'delete',
        params:{
            id
        }
    })
}

//获取单个招聘的信息
export function getUnitRec(id){
    return request({
        url:'/recruitment/get/'+id,
    })
}

//企业通过uid获得招聘列表
export function getRecList(id){
    return request({
        url:'/recruitment/getList/'+id,
    })
}


//发布和下架招聘
export function recRelease(id){
    return request({
        url:'/recruitment/release',
        method:'put',
        data:{id}
    })
}

//搜索已发布的招聘信息
export function searchRec(address,degree,workName,workKind,experience){
    return request({
        url:'/recruitment/search',
        params:{
            workKind,address,degree,workName,experience
        }
    })
}

//添加所需要技能
export function addRecsSkill(recruitmentSkill){
    return request({
        url:'/recruitment/skill',
        method:'post',
        data:recruitmentSkill
    })
}

//编辑所需要技能
export function putRecSkill(recruitmentSkill){
    return request({
        url:'/recruitment/skill',
        method:'put',
        data:recruitmentSkill
    })
}

//删除所需要技能
export function delRecSkill(id){
    return request({
        url:'/recruitment/skill',
        method:'delete',
        params:{
            id
        }
    })
}

//更新岗位信息
export function upRec(recruitment){
    return request({
        url:'/recruitment/update',
        method:'put',
        data:recruitment
    })
}


//投递简历
export function postDeliver(deliver){
    return request({
        url:'/student/deliver',
        method:'post',
        data:deliver
    })
}

//查看已投递列表
export function getDelivers(id){
    return request({
        url:'/deliver/'+id
    })
}

//邀请面试
export function sendInvite(invite){
    return request({
        url:'/invite',
        data:invite,
        method:'post'
    })
}
